package com.example.app.components


import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp

@OptIn(ExperimentalFoundationApi::class)
@Composable
fun LazyRowSample() {
    val data = listOf<Int>(1,2,3,4,5,6,7,8,9,0)
    LazyRow() {
        stickyHeader {
            Text(text = "通知",
                Modifier
                    .padding(8.dp)
                    .background(Color.Red)
                    .size(100.dp))
        }
        items(data) {
            Text(
                text = "Row Item $it",
                modifier = Modifier
                    .padding(8.dp)
                    .size(100.dp)
                    .background(Color.Blue)
            )
        }
    }
}

@Preview(
    showSystemUi = true
)
@Composable
fun LazyRowSamplePreview() {
    LazyRowSample()
}

